<?php
// +----------------------------------------------------------------------
// | Longbing [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright Chengdu longbing Technology Co., Ltd.
// +----------------------------------------------------------------------
// | Website http://longbing.org/
// +----------------------------------------------------------------------
// | Sales manager: +86-13558882532 / +86-13330887474
// | Technical support: +86-15680635005
// | After-sale service: +86-17361005938
// +----------------------------------------------------------------------

declare(strict_types=1);

namespace app\helppay\info;

use app\card\service\UserService;

use app\redbag\info\PermissionRedbag;
use app\shop\model\IndexUserInfo;
use longbingcore\diy\BaseSubscribe;

/**
 * @author shuixian
 * @DataTime: 2019/12/11 16:23
 * Class Subscribe
 * @package app\ucenter\info
 */
class Subscribe extends BaseSubscribe
{
//    /**
//     * 相应个人中心工具菜单
//     *
//     * @return mixed
//     * @author shuixian
//     * @DataTime: 2019/12/12 11:24
//     */
//    public function onAddWorkCenterModelMenu()
//    {
//
//        $permissson = new PermissionAppclass($this->_uniacid);
//
//        $user_model = new IndexUserInfo();
//
//        $is_class = $user_model->where(['fans_id'=>$this->getUserId()])->value('is_class');
//
//        $tmp = $is_class==1?
//                    [
//                        "title" => "门店数据",
//                        "icon" => "iconmendianshuju_1",
//                        "link" => "/appclass/pages/staff/data",
//                        "linkType" => 4
//                    ]:'';
//
//        if($permissson->pAuth()) {
//
//            $modelMenu = [
//                "title" => '约课管理',
//                "desc" => '',
//                "show" => true,
//                "row" => 4,
//                "list" => [
//                    [
//                        "title" => "课程预约",
//                        "icon" => "iconyaoqingdaili",
//                        "link" => "/appclass/pages/staff/appoint/list",
//                        "linkType" => 4
//                    ],
//                    [
//                        "title" => "课程表",
//                        "icon" => "iconxiajidingdan",
//                        "link" => "/appclass/pages/staff/schedule/list",
//                        "linkType" => 4
//                    ],
//                    [
//                        "title" => "会员卡",
//                        "icon" => "iconhuiyuanka",
//                        "link" => "/appclass/pages/staff/vipcard/list",
//                        "linkType" => 4
//                    ],
//                    [
//                        "title" => "员工约课",
//                        "icon" => "iconshengjishenqing",
//                        "link" => "/appclass/pages/staff/staff/appoint",
//                        "linkType" => 4
//                    ],$tmp
//                ]
//            ];
//
//            return [$modelMenu];
//        }
//        return [] ;
//    }





    /**
     * 监听代理管理端授权小程序事件
     *
     * @param $data
     * @return array
     * @author shuixian
     * @DataTime: 2019/12/27 17:33
     */
    public function onAgentAppAuthEdit($config)
    {

        $permission = new PermissionHelppay(0);

        if ($permission->sAuth() && $permission->infoConfig['auth_platform']) {

            $auth_switch['formType'] = 'radio';

            $auth_switch['name'] = 'helppay_switch';

            $auth_switch['value'] = $config ? $config[$auth_switch['name']] : 0;

            $auth_switch['title'] = $permission->info['title'];

            return [$auth_switch];

        }
    }


}